<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>更新时的一个问题</title>
    <script src="../../js/vue.js"></script>
    <style>
        *{
            font-size: 18px;
            font-weight: 700;
        }
    </style>
</head> 
<body>
    <div id="root">
        <h4>人员列表</h4>   
        <button @click='updateMei'>更新马冬梅的信息</button>
        <ul>
            <li v-for='person in personList' :key="person.id" >
                {{person.name}}-{{person.age}}--{{person.sex}}
            </li>
        </ul>

        
    </div>
    <script type="text/javascript">
        Vue.config.productionTip = false;
        const vm = new Vue({
            el: '#root',
            data: {
                personList: [
                    {id: 001, name: '周冬雨',age:22, sex: '女'},
                    {id: 002, name: '马冬梅',age:29, sex: '女'},
                    {id: 003, name: '周杰伦',age:31, sex: '男'},
                    {id: 004, name: '温兆伦',age:46, sex: '男'},
                    {id: 005, name: '陈道明',age:51, sex: '男'},
                    {id: 006, name: '姜文',age:46, sex: '男'},
                    {id: 007, name: '姜武',age:44, sex: '男'},
                    {id: '008', name: '梅超风',age:66, sex: '女'}
                ],
            },


            methods: {
                updateMei(){
                    // this.personList[1].name = '马老师' //奏效
                    // this.personList[1].age = 80  //奏效
                    // this.personList[1].sex = '男' //奏效
                    this.personList[1] = {id: 002, name: '马老师',age:80, sex: '男'}
                }

            },

        })
    </script>
</body>
</html>